// pages/applicationInDetail/applicationInDetail.js

Page({

    /**
     * 页面的初始数据
     */
    data: {
        name: '',
        school: '',
        major: '',
        grade: '',
        number: '',
        phone: '',
        qq: '',
        introduction: '该用户还没有设置个人简介',
        status: -1,
        messageId: 0,
        sessionID:'',
        projectId:"",
    },

    // 跳转到同意入队
    gotoAccept(e){
        wx.navigateTo({
          url: '/pages/project/accept/accept?messageId='+this.data.messageId+'&name='+this.data.name+'&projectId='+this.data.projectId+'&chuangNum='+this.data.chuangNum,
        })
    },

    // 跳转到拒绝理由
    gotoReason(e){ 
        wx.navigateTo({
          url: '/pages/project/reason/reason?messageId='+this.data.messageId+'&name='+this.data.name,
        })
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
      this.setData({
        status: options.status,
        messageId: options.messageId,
        chuangNum: options.ChuangNum,
        projectId:options.projectId
      })
     //console.log("storage sessionID:", wx.getStorageSync('sessionID'));
      //从缓存中取出sessionId
      this.setData({
          sessionID:wx.getStorageSync('sessionID')
      })
      wx.request({
        url: 'https://www.hschuangsai.com/user/info',
        data: {
          userChuangNum: options.ChuangNum,
        },
        header: {
          'content-type': 'application/json',
          'session': this.data.sessionID
        },
        method: 'GET',
        success: (result) => {
          if(result.data.code != 0){
            wx.showToast({
              title: result.data.commonErrorCode.errorSuggestion,
              icon: 'none'
            })
          }else{
            this.setData({
              name: result.data.data.name,
              school: result.data.data.school,
              major: result.data.data.department,
              grade: result.data.data.grade,
              number: '10215xxxxxx',
              phone: result.data.data.telephone,
              qq: result.data.data.qQ,
              introduction: result.data.data.resume,
            })
            console.log(this.data.introduction)
            var WxParse = require('../../wxParse/wxParse.js');
            var data=this.data;
            WxParse.wxParse('Intro', 'html', data.introduction, this, 10);
          }
        },
      })
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})